package com.hnu.java.test.tracfic;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;



public class LampControllor {

	
	private Lamp currentLamp;
	
	 LampControllor(){
		this.currentLamp=Lamp.S2N;
		currentLamp.light();
		
	 ScheduledExecutorService  timer	= Executors.newScheduledThreadPool(1);
	 timer.scheduleAtFixedRate(new Runnable() {
		
		public void run() {
			
			currentLamp=currentLamp.blackOut();
		}
	}, 10, 20, TimeUnit.SECONDS);
	}
}
